
package com.gp.activity.main;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.aphidmobile.flip.FlipViewController;
import com.gp.R;
import com.gp.activity.base.BaseActivity;
import com.gp.adapter.PictureAlbumAdapter;

/**
 * @author shijunxing
 * @className PictureAlbumActivity
 * @date Jul 22, 2013 3:34:05 PM
 * @version 1.0
 * @Description 画廊
 */
public class PictureAlbumActivity extends BaseActivity {

    private Button mBackButton ;
    //这里用了开源项目Aphid-FlipView，FlipViewController是核心类
    //主要实现图拍你的翻页效果
    private FlipViewController mFlipView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        //实例化FlipViewController，FlipViewController.HORIZONTAL设置翻页效果为
        //中轴水平翻页
        mFlipView = new FlipViewController(this, FlipViewController.HORIZONTAL);
        //由于FlipViewController继承的是AdapterView，所以要添加适配器，类似ListView
        //这里自定义一个Adapter
        mFlipView.setAdapter(new PictureAlbumAdapter(this));
        setContentView(mFlipView);
        initView();
        initListener();
        
       
    }
    
    private void initView() {
        // TODO Auto-generated method stub
        mBackButton = (Button) findViewById(R.id.btn_picturealum_back);
        
    }
    private void initListener() {
        // TODO Auto-generated method stub
        mBackButton.setOnClickListener(new OnClickListener() {
            
            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                PictureAlbumActivity.this.finish();
            }
        });
    }
    
    /* (非 Javadoc) 
     * @Title: onResume
     * @ 
     * @@see android.app.Activity#onResume()
     * @Description:  管理FlipViewController的状态
     * 
     */
    @Override
    protected void onResume() {
        super.onResume();
        mFlipView.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
        mFlipView.onPause();
    }
}
